
GameServerHelper = {
	GameServer = {
		Players = {

		}
	},
	--单机游戏服务器
	HalfMatchServes = {
		count = 1,
		HalfMatch = {
			players = {

			}
		}
	}
}

function GameServerHelper.HasPlayer( uuid )
	if GameServerHelper.GameServer.Players[uuid] ~= nil
		then
		return true;
	else
		return false;
	end
end

function GameServerHelper.GetPlayerInfo( uuid )
	local  player = GameServerHelper.GameServer.Players[uuid]
	if uuid == nil
		then
		print("Cant find player whith nil uuid")
		return GameServerHelper.GameServer.Players[1]
	end

	if player == nil
		then
		player = GameServerHelper.AddPlayer(uuid,uuid)
		print("Find Player :"..uuid.. "Not find")
	end
	return player
end

function  GameServerHelper.AddPlayer(uuid, playerName )
	GameServerHelper.GameServer.Players[uuid] = GameServerHelper.CreatePlayerInfo(uuid,playerName)
	return GameServerHelper.GameServer.Players[uuid]
end

--0 = 可以创建
function GameServerHelper.CheckIsCanAddPlayerByName(name )
	-- body
	return 0
end 

function GameServerHelper.CreatePlayerInfo( uuid,playerName )
	PlayerInfo = {
		uuid = uuid,
		name = playerName,
		gold = 100,
		lv = 1,
	}	
	return PlayerInfo
end


function GameServerHelper.SomeOneEnterHalfMatch(uuid)
	local count = GameServerHelper.HalfMatchServes.count
	GameServerHelper.HalfMatchServes.HalfMatch[count] = GameServerHelper.CreateHalfMatch(uuid)
	GameServerHelper.HalfMatchServes.count = GameServerHelper.HalfMatchServes.count+1
	return GameServerHelper.HalfMatchServes.HalfMatch[count]
end

function  GameServerHelper.GetHalfMathPlayerData( uuid )
	local  playerInfo = {

	}	
	player = GameServerHelper.GetPlayerInfo(uuid)
	playerInfo.uuid = player.uuid
	playerInfo.name = player.name
	return playerInfo
end
function GameServerHelper.CreateHalfMatch(uuid)
	print("server create HalfMatch")
	local HalfMatch = {
		players = {}
	}

	HalfMatch.players[1] = GameServerHelper.GetHalfMathPlayerData(1)
	HalfMatch.players[2] = GameServerHelper.GetHalfMathPlayerData(2)
	HalfMatch.players[3] = GameServerHelper.GetHalfMathPlayerData(3)
	HalfMatch.players[4] = GameServerHelper.GetHalfMathPlayerData(uuid)

	return HalfMatch
end